﻿using System.Collections.Generic;
using System.IO;
using System.Net;

namespace InstantWatch {
	public abstract class AProxy : IProxy {

		public abstract IEnumerable<QueueItem> GetUserQueue(int count);

		public virtual void RequestAuthorization() { }


		protected static string GetBoxArt(string sourcePath, string destinationPath) {
			if (!File.Exists(destinationPath)) {
				DirectoryInfo dir = new DirectoryInfo(Path.GetDirectoryName(destinationPath));
				if (!dir.Exists) dir.Create();
				using (WebClient wc = new WebClient()) {
					wc.DownloadFile(sourcePath, destinationPath);
				}
			}

			return new FileInfo(destinationPath).FullName;
		}

	}
}
